Are these two JavaScript statements equivalent under functional programming rules in React